<template>
	<view class="cart">
		<view class="cart-s" @click="tz">
			<image src="../../static/cartTest.png" mode=""></image>
			<view class="alarm" v-if="num>0">
				{{num}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			num: {
				type: [Number, String],
				default: 0
			}
		},
		methods: {
			tz() {
				uni.switchTab({
					url: '/pages/cart/cart'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.cart {
		position: fixed;
		bottom: 200rpx;
		right: 60rpx;
		background-color: #FFFFFF;
		border-radius: 50rpx;
		width: 90rpx;
		height: 90rpx;
		z-index: 999;
		display: flex;
		align-items: center;
		justify-content: center;

		.cart-s {
			position: relative;
		}

		image {
			width: 60rpx;
			height: 55rpx;
		}

		.alarm {
			position: absolute;
			color: white;
			font-size: 17rpx;
			background-color: red;
			/*height: 24px;改前*/
			min-height: 24rpx;
			/*改后新增的代码*/
			min-width: 40rpx;
			/*改后新增的代码*/
			line-height: 24rpx;
			// right: -25%;
			top: -16rpx;
			left: 30rpx;
			text-align: center;
			-webkit-border-radius: 24rpx;
			border-radius: 24rpx;
			padding: 8rpx;
		}
	}
</style>
